<!doctype html>
<!--
Tests that attempts to use the Payment Request API are denied while in the VR
Browser.
-->
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="../resources/webxr_e2e.css">
  </head>
  <body>
    <script src="../../../../../../third_party/blink/web_tests/resources/testharness.js"></script>
    <script src="../resources/webxr_e2e.js"></script>
    <script>
      setup({single_test: true});

      // Arbitrary but valid data to pass to PaymentRequest to trigger the
      // native Payment Request UI.
      var methods = [
        {
          supportedMethods: "basic-card",
          data: {
            supportedNetworks: [
              "visa",
              "mastercard",
            ],
            supportedTypes: [
              "debit",
              "credit",
            ],
          },
        },
      ];

      var details = {
        id: "Super VR Store",
        displayItems: [
          {
            label: "Sub-total",
            amount: {
              currency: "USD",
              value: "10.00",
            },
          },
          {
            label: "Sales Tax",
            amount: {
              currency: "USD",
              value: "1.00",
            },
          },
        ],
        total: {
          label: "Total",
          amount: {
            currency: "USD",
            value: "11.00",
          },
        },
      };

      var request = new PaymentRequest(methods, details);

      function stepRequestPayment() {
        request.show().then(() => {
          assert_unreached("Payment request was shown and accepted");
        }, (err) => {
          assert_true(err instanceof DOMException,
                      "Payment request denied, but not for expected reason");
          done();
        });
      }
    </script>
  </body>
</html>
